//
//  MqInfoPicureTableViewCell.m
//  Meiqi
//
//  Created by 王郑 on 16/1/14.
//  Copyright © 2016年 KFC. All rights reserved.
//

#import "MqInfoPicureTableViewCell.h"

@implementation MqInfoPicureTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        _picImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 300*kHeightBase)];
        _picImageV.backgroundColor  = [UIColor yellowColor];
        [self.contentView addSubview:_picImageV];
        
        _holderView = [[UIView alloc] initWithFrame:CGRectMake(0, _picImageV.bottom - 100*kHeightBase, kScreenWidth, 100*kHeightBase)];
        _holderView.backgroundColor = [UIColor grayColor];
        _holderView.alpha = 0.75;
        [_picImageV addSubview:_holderView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20*kWidthBase,10*kHeightBase, kScreenWidth - 40*kWidthBase, _holderView.height / 3)];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:20];
        [_holderView addSubview:_titleLabel];
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.left, _titleLabel.bottom + 10*kHeightBase, (kScreenWidth - 40*kWidthBase) / 2, _holderView.height / 3)];
        _timeLabel.textColor = [UIColor whiteColor];
        _timeLabel.font = [UIFont systemFontOfSize:15];
        [_holderView addSubview:_timeLabel];
        
        _picNumLabel = [[UILabel alloc] initWithFrame:CGRectMake(_timeLabel.right, _titleLabel.bottom, _timeLabel.width, _timeLabel.height)];
        _picNumLabel.textColor = [UIColor whiteColor];
        _picNumLabel.textAlignment = NSTextAlignmentRight;
        _picNumLabel.font = [UIFont systemFontOfSize:21];
        [_holderView addSubview:_picNumLabel];
        
    }
    
    
    return self;
}



- (void)setModel:(MqInfoPictureModel *)model
{
    
    _model = model;
    
    // 赋值
    [_picImageV sd_setImageWithURL:[NSURL URLWithString:model.titlePic] placeholderImage:[UIImage imageNamed:@"infoplaceholder"]];
    _titleLabel.text = model.title;
    _timeLabel.text = model.newstime;
    _picNumLabel.text = [NSString stringWithFormat:@"%@P",model.picnum];
     
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
